using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Xml;
using System.Web.UI;
using System.Web.UI.WebControls;
 

public partial class SearchPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string fileName = Server.MapPath("Books.xml");
        XmlDocument xmlDocument = new XmlDocument();
        xmlDocument.Load(fileName);
        
        XmlNodeList xmlNodeList =
        xmlDocument.GetElementsByTagName("book");
        XmlNode xmlNode = SearchNode(
        xmlNodeList, "ISBN", this.txtISBN.Text);

        ShowNode(xmlNode);
    }

    XmlNode SearchNode(XmlNodeList xmlNodeList, 
    string xmlNodeName, string xmlNodeValue)
    {          
        XmlNode xmlNodeIndex = null;
        foreach (XmlNode xmlNode in xmlNodeList)
        {
            if(xmlNode.Attributes[xmlNodeName].Value
            == xmlNodeValue)
            {
                xmlNodeIndex= xmlNode;
                break;
            }             
        }
        return xmlNodeIndex;
    }
    void ShowNode(XmlNode xmlNode )
    {

        Literal1.Text = 
        xmlNode["title"].InnerText + "<br>";
        Literal1.Text += 
        xmlNode["price"].InnerText +"<br>";
        Literal1.Text += 
        xmlNode["publisher"].InnerText ;
    }
}
